<!--
 * @Author: Qimu
 * @Date: 2020-04-25 06:40:21
 * @LastEditors: Qimu
 * @LastEditTime: 2020-09-14 23:12:57
 * @Description: file content
 * @FilePath: \vue-admin-koa2\vue-admin\src\components\Dialogs\EditRole.vue
 -->
<template>
  <div class="role">
    <!-- 编辑角色 start-->
    <el-dialog title="编辑角色" :visible.sync="editRoleFormCom.editRoleDialogVisible" width="20%">
      <!-- :rules="editRoleFormRules" -->
      <el-form
        class="editRoleForm"
        :model="editRoleFormCom.editRoleForm"
        ref="editRoleFormRef"
        size="mini"
        label-width="100px"
      >
        <el-form-item label="角色名称" prop="role_name">
          <el-input v-model="editRoleFormCom.editRoleForm.role_name"></el-input>
        </el-form-item>
        <el-form-item label="角色简述" prop="role_sketch">
          <el-input type="textarea" v-model="editRoleFormCom.editRoleForm.role_sketch"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editRoleFormCom.editRoleDialogVisible = false" size="mini">取 消</el-button>
        <el-button type="primary" @click="confirmEditRole" size="mini">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 编辑角色 end-->
  </div>
</template>

<script>
export default {
  name: 'EditRole',
  props: {
    editRoleFormCom: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {}
  },
  methods: {
    //编辑角色对话框的提交事件
    confirmEditRole() {
      const data = {
        _id: this.editRoleFormCom.editRoleForm._id,
        role_name: this.editRoleFormCom.editRoleForm.role_name,
        role_sketch: this.editRoleFormCom.editRoleForm.role_sketch,
      }
      this.$emit('confirmEditRole', data) //向父组件Role.vue传值
      this.editRoleFormCom.editRoleDialogVisible = false //关闭编辑角色对话框
    },
  },
}
</script>

<style lang="sass" scoped>
.editRoleForm 
  .el-input 
    width: 150px
</style>
